package service.temp.job.matching.poc.listingapi.utils;

import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import lombok.experimental.UtilityClass;

/**
 * @author Chao Xiong (chxiong@coupang.com)
 */
@UtilityClass
public class JsonUtils {
    private static final ObjectMapper DEFAULT_MAPPER = newMapper();

    public static ObjectMapper newMapper() {
        ObjectMapper mapper = new ObjectMapper();
        mapper.registerModule(new JavaTimeModule());
        mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);

        return mapper;
    }

    public static ObjectMapper mapper() {
        return DEFAULT_MAPPER;
    }
}
